<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMomentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('moments', function (Blueprint $table) {
            $table->increments('id');
            $table->char('muid',64)->default("")->comment("动态唯一id");
            $table->unsignedInteger("uuid")->default(0)->comment("发布用户")->index("user");
            $table->string("city",64)->default("")->comment("发布城市");
            $table->string("address",255)->default("")->comment("详细的地址");
            $table->string("cates", 128)->default('')->comment("标签uuid | CODE|隔离");
            $table->enum("type",['Y','N'])->default("Y")->comment("发布类型Y分享N吐槽");
            $table->decimal("latitude",10,4)->default(0.0)->comment("纬度");
            $table->decimal("longitude",10,4)->default(0.0)->comment("经度");
            $table->enum("is_pub",['Y','N'])->default("Y")->comment("是否公开Y是N否");
            $table->unsignedInteger("comment_count")->default(0)->comment("评论数量");
            $table->unsignedInteger("like_count")->default(0)->comment("点赞数量");
            $table->text("imgs")->comment("图片内容{'path':''}");
            $table->text("content")->comment("动态内容");
            $table->float("price")->comment("价格");
            $table->softDeletes();
            $table->timestamps();
            $table->engine = 'InnoDB';
            $table->charset = 'utf8';
            $table->collation='utf8_general_ci';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('moments');
    }
}
